import request from '@/axios'
import { agentRequest } from '@/utils/cache'
import { itemBody } from '../types/dictType'

function formatRequestUri(name, sysHead) {
  return sysHead + '/enum/' + name
}
export function GetItems(name: string, sysHead: string): Promise<itemBody[]> {
  const key = 'EnumDic_' + name + '_' + sysHead
  return agentRequest(key, () => {
    return request.get({
      url: formatRequestUri('GetItems', sysHead),
      params: {
        name
      }
    })
  })
}
export function Gets(keys: string, sysHead: string) {
  return request.post({
    url: formatRequestUri('Gets', sysHead),
    data: keys
  })
}
